package nl.utwente.eemcs.common.helpers;

public enum DataEdgeType {
	Create,
	Read,
	Write,
	ReadWrite,
	Delete;
	
	public static DataEdgeType fromString(String input) {
		if (input.equalsIgnoreCase("C"))
			return DataEdgeType.Create;
		else if (input.equalsIgnoreCase("R"))
			return DataEdgeType.Read;
		else if (input.equalsIgnoreCase("W"))
			return DataEdgeType.Write;
		else if (input.equalsIgnoreCase("RW"))
			return DataEdgeType.ReadWrite;
		else if (input.equalsIgnoreCase("D"))
			return DataEdgeType.Delete;
		else
			return null;
	}
	
	public static String convertToString(DataEdgeType type) {
		if (type == DataEdgeType.Create)
			return "C";
		else if (type == DataEdgeType.Read)
			return "R";
		else if (type == DataEdgeType.Write)
			return "W";
		else if (type == DataEdgeType.ReadWrite)
			return "RW";
		else if (type == DataEdgeType.Delete)
			return "D";
		else
			return null;
	}	
}
